# -*- coding:utf-8 -*-
import redis


class Config(object):
    """配置信息类"""
    DEBUG = True

    # 密码生成:ipython;import os,base64;base64.b64encode(random(48))
    SECRET_KEY = "mkNq+g2a/Wkm91xd4VdWW2V5SVtvsz5iF9Tg9zYiTmeojOV2mpo8aUBIYhguudZ/"

    # 数据库配置
    SQLALCHEMY_DATABASE_URI = "mysql://root:123456@localhost:3306/IHome"
    SQLALCHEMY_TRACK_MODIFICATIONS = False

    # redis 链接配置
    REDIS_HOST = "127.0.0.1"
    REDIS_PORT = 6379

    # session的配置
    SESSION_TYPE = "redis"
    # 将session保存到redis
    SESSION_REDIS = redis.StrictRedis(host=REDIS_HOST, port=REDIS_PORT)
    # 签名
    SESSION_USE_SIGNER = True
    # 设置过期时间
    PERMANENT_SESSION_LIFETIME = 86400


class DevelopmentConfig(Config):
    """开发环境下的配置"""
    DEBUG = True


class ProductionConfig(Config):
    """生产环境下的配置"""
    pass


config = {
    "development": DevelopmentConfig,
    "production":ProductionConfig
}
